import { DialogConfig } from '@/components/mm-dialog/type'

export const dialogConfig: DialogConfig = {
  width: 580,
  showLabel: true,
  labelWidth: 80,
  layout: [
    {
      gutter: 20,
      formItems: [
        {
          label: '父级菜单',
          prop: 'parent_id',
          type: 'select',
          placeholder: '请选择父级菜单',
          optionsGetter: 'menu/menuOptionsWithPrefix',
          optionSlot: 'parent',
          rules: [{ required: true, message: '必填项不能为空', trigger: 'change' }]
        },
        {
          label: '菜单类型',
          prop: 'type',
          type: 'select',
          placeholder: '请选择菜单类型',
          options: [
            { label: '导航菜单', value: 0 },
            { label: '权限节点', value: 1 }
          ],
          rules: [{ required: true, message: '必填项不能为空', trigger: 'change' }]
        }
      ]
    },
    {
      gutter: 20,
      formItems: [
        {
          label: '状态',
          prop: 'status',
          type: 'radio',
          placeholder: '请选择状态',
          options: [
            { label: '禁用', value: 0 },
            { label: '启用', value: 1 }
          ],
          rules: [{ required: true, message: '必填项不能为空', trigger: 'change' }]
        },
        {
          label: '排序',
          prop: 'sort',
          type: 'number',
          placeholder: '请输入排序号',
          default: 0,
          bind: {
            min: 0,
            max: 99,
            controlsPosition: 'right'
          }
        }
      ]
    },
    {
      gutter: 20,
      formItems: [
        {
          label: '菜单名称',
          prop: 'name',
          type: 'input',
          placeholder: '请输入菜单名称',
          rules: [
            { required: true, message: '必填项不能为空', trigger: 'blur' },
            { max: 10, message: '不能超过 10 个字符', trigger: 'blur' }
          ]
        },
        {
          label: '菜单图标',
          prop: 'icon',
          type: 'input',
          placeholder: '请输入菜单图标',
          rules: [{ required: true, message: '必填项不能为空', trigger: 'blur' }]
        }
      ]
    },
    {
      gutter: 20,
      formItems: [
        {
          label: '菜单URL',
          prop: 'url',
          type: 'input',
          placeholder: '请输入菜单URL',
          rules: [{ required: true, message: '必填项不能为空', trigger: 'blur' }]
        },
        {
          label: '权限标识',
          prop: 'permission',
          type: 'input',
          placeholder: '请输入权限标识',
          rules: [{ required: true, message: '必填项不能为空', trigger: 'blur' }]
        }
      ]
    }
  ]
}
